package com.gujiangbo.oom;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @Author: gujiangbo.co
 * @Contact: 646832012@qq.com
 * @Date: 2022/3/12 19:42
 * @Version: 1.0
 * @Description: JVM 参数配置演示
 * GC overhead limit exceeded----
 * -Xms10m -Xmx10m -XX:MaxDirectMemorySize=5m
 */
public class JavaOverHeadLimitExceededDemo {

    public static void main(String[] args) {
        int i = 0;
        List<String> list = new ArrayList<>();
        try {
            while (true) {
                list.add(String.valueOf(++i).intern());
            }
        } catch (Throwable e) {
            System.out.println("***** i=" + i);
            throw e;
        }

    }
}
